#include<iostream>
#include<cstring>


class Student
{
private:
    std::string name;
    int id;
    int *score;
public:
    
    Student(std::string name, int id,int score1,int score2,int score3);//有参构造函数   


    double average();
    void display();


    ~Student();
};

Student::Student(std::string name, int id,int score1,int score2,int score3)
{
    this->score = new int[3];

    this->name = name;
    this->id = id;
    this->score[0]=score1;
    this->score[1]=score2;
    this->score[2]=score3;
}

double Student::average()
{
    return (this->score[0]+this->score[1]+this->score[2]) / 3.0;
}

void Student::display()
{
    std::cout<<"学生的姓名是："<<this->name<<std::endl;
    std::cout<<"学生的学号是："<<this->id<<std::endl;
    std::cout<<"学生"<<this->name<<"的第一门成绩是："<<this->score[0]<<std::endl;
    std::cout<<"学生"<<this->name<<"的第二门成绩是："<<this->score[1]<<std::endl;
    std::cout<<"学生"<<this->name<<"的第三门成绩是："<<this->score[2]<<std::endl;
    std::cout<<"学生"<<this->name<<"的平均分是"<<this->average()<<std::endl;
}

Student::~Student()
{
    delete []score;
}


int main()
{

    Student a("老六",21,16,56,32);

    a.display();

    return 0;
}
